package top.hekun.study.core.visitor.method.frame;

import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.ModuleVisitor;

/**
 * 〈frame 示例〉
 *
 * @author: Sakura
 * @date: 2023/5/15
 */
public class MethodStackMapFrameVisitor extends ClassVisitor {
    private String owner;
    public MethodStackMapFrameVisitor(int api, ClassVisitor classVisitor) {
        super(api, classVisitor);
    }

    public MethodStackMapFrameVisitor(int api ) {
        super(api);
    }

    @Override
    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
        super.visit(version, access, name, signature, superName, interfaces);
        this.owner = name;
    }

    @Override
    public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
        MethodVisitor methodVisitor = super.visitMethod(access, name, descriptor, signature, exceptions);
        return new MyMethodVisitor1(owner,access,name,descriptor,methodVisitor);
    }
}
